package com.tnl.web.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.biz.hunter.db.entity.City;
import com.biz.hunter.dbutil.BaseDAO;
import com.tnl.web.domain.Role;


@Repository
public class RoleDAO {
	private static final String SQL_GET_ID = "select * from tb_role  where id = ?";
	private static final String SQL_GET_NAME = "select * from tb_role  where Name = ?";
	private static final String SQL_GET_ALL = "select * from tb_role ";
	
	
	public List<Role> getALL() {
		return BaseDAO.queryForList(Role.class, SQL_GET_ALL);
	}
	
	public Role getById(int Id) {
		return  BaseDAO.queryForObject(Role.class, SQL_GET_ID, Id);
	}
	public Role getByName(String name){
		return  BaseDAO.queryForObject(Role.class, SQL_GET_NAME, name);
	}

	public Role findByRolename(String rolename) {
		return getByName(rolename);
	}

	
	
}
